<%--
  Created by IntelliJ IDEA.
  User: zhongjieyu
  Date: 2014/11/3
  Time: 10:33
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set value="${pageContext.request.contextPath}" var="path" scope="page"/>

<%

    //1.工程路径
    String pajectPath = request.getContextPath();
%>
<html>
<head>
    <title>发布-项目任务</title>

    <style type="text/css">

        .spanClass{
            background-color: #000000;
            color: honeydew;

        }

    </style>
    <script type="text/javascript" src="${path}/js/jquery-2.1.1.js"></script>
    <script type="text/javascript">

        $(function(){

            var addvalueData = ${addvalueList};

            initData(addvalueData);
        });


        //初始化需求技能、需求风格数据
        function initData(data){



            f_showAddvalue(data);

        }



        ///处理增值服务
        function f_showAddvalue(addvalues){

            console.log("====" + addvalues);

            var sumPrice = 0;

            var html = "";
            for(var i in addvalues){
                var ss = addvalues[i];

                html += "<span value="+ss.av_order_id+">"+ss.name+ "(￥" + ss.price + ")</span> <br />"

                sumPrice += parseFloat(ss.price);
            }

            $("#addValueTd").html(html);


            $("#addValueSum").html("<span style='color:red;' value="+sumPrice+">￥" + sumPrice + "元</span>");
        }

        //去支付
        function f_goPay(){


            //支付......

            var payType = $("input[name='payType']:checked").val();
            var url = "";
            if("alipay" == payType){
                url = "${path}/taskInfo/addvaluePayByAlipay.html"
            }else if("paypay" == payType){
                url = "${path}/taskInfo/addvaluePayByPaypay.html"
            }else{
                url = "${path}/taskInfo/addvaluePayByBalance.html"
            }

            if(!confirm("是否确定支付？")){

                return;

            }

            $.post(url,{task_id:"${task_id}"},function(data){


                if(data){
                    window.location.href = "${path}/taskInfo/paySuccess.html";
                }else{
                    alert("支付失败，请检查支付信息！");
                }

            });


            <%--//支付成功后 test--%>
            <%--if(confirm("test是否支付成功？")){--%>

                <%--$.post("${path}/taskInfo/publishTaskInfo.html",{task_id:"${task_id}"},function(data){--%>

                <%--});--%>
            <%--}--%>


        }

    </script>
</head>
<body>

    <div style="width:1080px; height:100%; margin-left: auto;margin-right: auto; border: 1px solid #000000;">
        <div style="width: 100%;height: 50px; border-bottom: 1px solid #000000;">
            <h3><span >1.描述需求</span>
            <span >2.确认需求</span>
            <span style="background-color: #000000;color: #dddddd;">3.发布需求并支付</span>
            <span>4.完成</span>
            </h3>
        </div>

       <form id="taskForm" name="taskForm" action="#" method="POST">


       <table width="1028" >

           <tr>
               <td style="text-align: center;">
                   费用明细
               </td>
               <td id="addValueTd">


               </td>
           </tr>

           <tr>
               <td style="text-align: center;">
                   费用合计
               </td>
               <td id="addValueSum">


               </td>
           </tr>


       </table>
           <hr/>
</form>
            <div style="width: 100%;height:200px; border: 1px solid red;">




                <div  style="width: 200px;height: 200px; float: left; border: 1px solid #000000;">
                    <label>
                       发布招标项目
                    </label>
                    仅可选择一个竞标者参与项目，仅可使用使用参与者作品
                </div>

                <div  style="width: 200px;height: 200px; float: left;">

                </div>

                <div  style="width: 200px;height: 150px; float: left; border: 1px solid red; text-align: center; font-size: 8pt;">
                    <label style="font-size: 18pt;">
                        发布悬赏竞赛活动
                    </label>
                    可选多个艺术家参与项目，可任意选择作品获奖，可使用多人参赛作品
                </div>
                
            </div>
            <button  onclick="f_goPay()">去支付</button>

</div>
</body>
</html>
